package com.yss.system.api.domain;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yss.common.core.annotation.EasyExcel;
import com.yss.common.core.utils.easyexecl.IntegerConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 系统访问记录表 sys_logininfor
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_logininfor")
public class SysLogininfor {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @ExcelIgnore
    @TableId("ID")
    private String id;

    /**
     * 用户账号
     */
    @ExcelProperty(value = "用户账号")
    @TableField("USER_NAME")
    private String userName;

    /**
     * 状态 0成功 1失败
     */
    @ExcelProperty(value = "状态", converter = IntegerConverter.class)
    @EasyExcel(readConverterExp = "1=成功,2=失败")
    @TableField("STATUS")
    private Integer status;

    /**
     * 地址
     */
    @ExcelProperty(value = "地址")
    @TableField("IPADDR")
    private String ipaddr;

    /**
     * 描述
     */
    @ExcelProperty(value = "描述")
    @TableField("MSG")
    private String msg;

    /**
     * 访问时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "访问时间")
    @TableField("ACCESS_TIME")
    private Date accessTime;
    /**
     * 请求参数
     */
    @ExcelIgnore
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private Map<String, Object> params;

    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

}
